From: Ray Strode Date: Wed, 19 Oct 2011 20:21:59 +0000 (-0400) Subject: global: drop incorrect memset X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7403 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=de352a309dfc3ac5c6573d95f13de0edadb5195d;p=gnome-shell.git global: drop incorrect memset shell_global_get_memory_info tries to zero initialize the output parameter with memset, but it passes the wrong size (because of a missing *). There's no reason to do the memset, though. In the normal case all members of the struct gets initialized before the function returns anyway. This commit drops the memset call in favor of one explicit 0 assignment that only gets executed on on atypical platforms. https://bugzilla.gnome.org/show_bug.cgi?id=662236 --- diff --git a/src/shell-global.c b/src/shell-global.c index 26e607f15..13ce7b7af 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1182,12 +1182,13 @@ shell_global_get_memory_info (ShellGlobal *global, JSContext *context; gint64 now; - memset (meminfo, 0, sizeof (meminfo)); #ifdef HAVE_MALLINFO { struct mallinfo info = mallinfo (); meminfo->glibc_uordblks = info.uordblks; } +#else + meminfo->glibc_uordblks = 0; #endif context = gjs_context_get_native_context (global->js_context);